﻿<UserControl x:Class="XamlaApp.Views.ElementPropertyViews.BorderProperties"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:prop="clr-namespace:XamlaApp.Views.ElementPropertyViews"
             xmlns:form="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
             xmlns:Controls="clr-namespace:SilverlightContrib.Controls;assembly=SilverlightContrib.Controls">
    <StackPanel>
        <prop:FrameworkElementProperties></prop:FrameworkElementProperties>
        <form:DataForm CurrentItem="{Binding}">
            <form:DataForm.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="Border Properties"></TextBlock>
                </DataTemplate>
            </form:DataForm.HeaderTemplate>
            <form:DataForm.EditTemplate>
                <DataTemplate>
                    <StackPanel>
                        <form:DataField Label="Thickness">
                            <StackPanel Orientation="Horizontal">
                                <Slider Style="{StaticResource xamla_propertymenu_slider}" Minimum="1" Maximum="50" Value="{Binding BorderThickness, Converter={StaticResource ThicknessConverterResource}, Mode=TwoWay}"></Slider>
                                <TextBox Style="{StaticResource xamla_propertymenu_numerictextbox}" Text="{Binding BorderThickness, Converter={StaticResource ThicknessConverterResource}, Mode=TwoWay}" ></TextBox>
                            </StackPanel>
                        </form:DataField>
                        <form:DataField Label="Rounding">
                            <StackPanel Orientation="Horizontal">
                                <Slider Style="{StaticResource xamla_propertymenu_slider}" Minimum="0" Maximum="50" Value="{Binding CornerRadius, Converter={StaticResource CornerRadiusConverterResource}, Mode=TwoWay}"></Slider>
                                <TextBox Style="{StaticResource xamla_propertymenu_numerictextbox}"  Text="{Binding CornerRadius, Converter={StaticResource CornerRadiusConverterResource}, Mode=TwoWay}" ></TextBox>
                            </StackPanel>
                        </form:DataField>
                        <form:DataField>
                            <Grid>
                                <Button HorizontalContentAlignment="Left" Click="Button_Click" Tag="{Binding ElementName=popupColorPickerStroke}">
                                    <Button.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <Rectangle Width="20" Height="20" Stroke="{Binding StrokeBrush}" StrokeThickness="2" Fill="{Binding FillBrush}" ></Rectangle>
                                            <TextBlock Margin="5,0,0,0" Text="Line Color..."></TextBlock>
                                        </StackPanel>
                                    </Button.Content>
                                </Button>
                                <Popup x:Name="popupColorPickerStroke" >
                                    <Border BorderBrush="Black" BorderThickness="1">
                                        <StackPanel>
                                            <Controls:ColorPicker SelectedColorChanging="ColorPicker_SelectedStrokeChanging" SelectedColor="{Binding StrokeBrush, Mode=TwoWay, Converter={StaticResource SolidColorBrushToColorConverterResource}}">
                                            </Controls:ColorPicker>
                                            <Button Content="Finished" Click="Button_Click" Tag="{Binding ElementName=popupColorPickerStroke}"></Button>
                                        </StackPanel>
                                    </Border>
                                </Popup>
                            </Grid>
                        </form:DataField>
                        <form:DataField>
                            <Grid>
                                <Button HorizontalContentAlignment="Left" Click="Button_Click" Tag="{Binding ElementName=popupColorPicker}">
                                    <Button.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <Rectangle Width="20" Height="20" Stroke="{Binding StrokeBrush}" StrokeThickness="2" Fill="{Binding FillBrush}"></Rectangle>
                                            <TextBlock Margin="5,0,0,0" Text="Fill Color..."></TextBlock>
                                        </StackPanel>
                                    </Button.Content>
                                </Button>
                                <Popup x:Name="popupColorPicker" >
                                    <Border BorderBrush="Black" BorderThickness="1">
                                        <StackPanel>
                                            <Controls:ColorPicker SelectedColorChanging="ColorPicker_SelectedFillColorChanging" SelectedColor="{Binding FillBrush, Mode=TwoWay, Converter={StaticResource SolidColorBrushToColorConverterResource}}">
                                            </Controls:ColorPicker>                                           
                                            <Button Content="Make Transparent" x:Name="btnMakeTransparent" Click="btnMakeTransparent_Click" Tag="{Binding ElementName=popupColorPicker}"></Button>
                                            <Button Content="Finished" Click="Button_Click" Tag="{Binding ElementName=popupColorPicker}"></Button>
                                        </StackPanel>
                                    </Border>
                                </Popup>
                            </Grid>
                        </form:DataField>
                    </StackPanel>
                </DataTemplate>
            </form:DataForm.EditTemplate>
        </form:DataForm>
    </StackPanel>
</UserControl>
